package com.mark.spring.annotation.register.imports;

import com.mark.spring.annotation.register.imports.register.Registrar;
import com.mark.spring.annotation.register.imports.selector.Selector;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.util.Assert;

/**
 * @Description: Import引导类
 * @Author: Mark
 * @CreateDate: 2019/9/22 11:13
 * @Version: 3.00.001
 * @Copyright : 豆浆油条个人非正式工作室
 */
@ComponentScan("com.mark.spring.annotation.register.imports")
public class ImportBootstrap {

    public static void main(String[] args) {
        //加载配置，获取bean
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(ImportBootstrap.class);

        Shoes shoes = applicationContext.getBean(Shoes.class);
        Selector selector = applicationContext.getBean(Selector.class);
        Registrar registrar = applicationContext.getBean(Registrar.class);

        Assert.notNull(shoes,"shoes bean为空");
        Assert.notNull(selector,"selector  bean为空");
        Assert.notNull(registrar,"registrar  bean为空");

        //关闭上下文
        applicationContext.close();

    }
}
